#ifndef _VITERBILIB_H
#define _VITERBILIB_H

#include "Types.h"

/* Bitmasks used to get a specify Bits from Byte */
#define BIT_0	0x01
#define BIT_1	0x02
#define BIT_2	0x04
#define BIT_3	0x08
#define BIT_4	0x10
#define BIT_5	0x20
#define BIT_6	0x40
#define BIT_7	0x80

#define STATE	0x7E

#define ALL_STATES_FILLED	6
#define MAX_COLUMNS	(BitsNo/2) + 1

/* Types which describe Table of states */
typedef struct
{
	UINT8	Input;
	UINT8	Register;
	UINT8	NextState;
	UINT8	Output[2];
} VITERBI_IN_OUT;

typedef struct
{
	UINT8			State;
	VITERBI_IN_OUT	Info[2];
} VITERBI_STATES;

/* Types which are responsible for Viterbi Graph crate describing */

typedef struct
{
	UINT8	HmgZero;	/* Hamming Distance when arrow goes by binary 0 */
	UINT8	HmgOne;		/* Hamming Distance when arrow goes by binary 1 */
} METRIC;

typedef struct _POINT
{
	UINT8			Row;
	UINT32			Column;
	METRIC			Distance;
	UINT8			CumulDist;			/* Cumulated Hamming Distance */
	UINT16			MinCumulDist;
	struct _POINT*	NextStateZero;
	struct _POINT*	NextStateOne;
	UINT8			Sequence[5000];
	BOOL			Active;
} POINT;

#endif 
